import {view, ViewConnector} from "adajs";
import ContainerService from "../../../../controls/container/state";
import Tabwin from "./../../../../controls/tab/win";
import LodgeDetail from "../../../../controls/detail/lodge";
import Bar from "../../../../controls/bar";

@view({
    className: "page",
    template: "./template.html",
    style: "./style.scss"
})
class Page extends ViewConnector {
    setContextDataSets(connect) {
        let userInfo = connect(ContainerService, current => {
            return current.userInfo;
        }, (current, data) => {
            current.userInfo = data.userInfo;
        });
        let tabs = [
            {"name": "支部信息", active: true, type: LodgeDetail, option: {id: userInfo.userInfo.userDeptId}},
            {"name": "支部学习", active: false, type: Bar, option: {}},
            {"name": "支部活动", active: false, type: Bar, option: {}},
            {"name": "出勤情况", active: false, type: Bar, option: {}},
            {"name": "交流互动", active: false, type: Bar, option: {}}
        ];
        return {userInfo, tabs};
    }

    onupdate(current, data) {
        Object.assign(current, data);
    }

    tags() {
        return {
            tab: Tabwin
        }
    }
}

export default Page;